﻿
#ifndef __RouteViewController__
#define __RouteViewController__

#include "CrossApp.h"
#include "AmapView.h"

USING_NS_CC;

class RouteViewController : public CAViewController, public CATableViewDataSource, public CATableViewDelegate, public AmapViewDelegate
{
    
public:

	RouteViewController();
    
	virtual ~RouteViewController();
    
protected:
    
    void viewDidLoad();
    
    void viewDidUnload();

	virtual void onDriveRouteSearched(int code, DriveRouteData data);

	virtual void onWalkRouteSearched(int code, WalkRouteData data);

	virtual void onBusRouteSearched(int code, std::vector<BusRouteData> data);

	virtual void onBusRouteSteps(int code, int bustag, std::vector<BusRouteStep> datas);

	virtual CATableViewCell* tableCellAtIndex(CATableView* table, const DSize& cellSize, unsigned int section, unsigned int row);

	virtual unsigned int tableViewHeightForRowAtIndexPath(CATableView* table, unsigned int section, unsigned int row);

	virtual unsigned int numberOfRowsInSection(CATableView* table, unsigned int section);

	virtual CAView* tableViewSectionViewForHeaderInSection(CATableView* table, const DSize& viewSize, unsigned int section);

	virtual unsigned int tableViewHeightForHeaderInSection(CATableView* table, unsigned int section);

	virtual void tableViewDidSelectRowAtIndexPath(CATableView* table, unsigned int section, unsigned int row);

	void segController(CASegmentedControl* seg, int index);

	void updateUI(float t);	

private:

	int m_iCode;

	int m_iIndex;

	AmapView* m_pAmapView;

	DriveRouteData drivateData;

	WalkRouteData walkData;

	std::vector<BusRouteData> busData;

	CATableView* m_pTableView;
};


#endif
